CREATE OR REPLACE PACKAGE "public"."klog" AUTHID CURRENT_USER AS
    /**
        日志级别约定（数据库默认为info级别）：
            ①不向前端输出：记录数据库执行细节而不无需向前端输出，仅作为更详细的数据库执行跟踪，使用log或debug级别打印（一般不开启）。（debug为更细节的输出，设置kingbase.conf中的min_log_level=log/debug5）
            ②向前端输出debug：需要向前端输出调试信息，如链路请求的传递参数信息，数据库中使用klog.debug打印 （raise info）
            ③向前端输出info：需要向前端输出业务的执行信息，如应用创建的进度信息，数据库中使用klog.info打印（raise notice）
            ④向前端输出warn：需要向前端输出警告信息，数据库中使用klog.warn打印 （raise warning）
     */
    LOG_LEVEL_NONE CONSTANT INT = 0;
    LOG_LEVEL_DEBUG_FILE CONSTANT INT = 1; 
    LOG_LEVEL_LOG_FILE CONSTANT INT = 2; 
    LOG_LEVEL_DEBUG CONSTANT INT = 3; 
    LOG_LEVEL_INFO CONSTANT INT = 4; 
    LOG_LEVEL_WARNING CONSTANT INT = 5; 
    LOG_LEVEL_EXCEPTION CONSTANT INT = 6; 
    SUBTYPE LOGLEVEL IS int range 0..6;
    log_level KLOG.LOGLEVEL;
    PROCEDURE raise_(lg_lv KLOG.LOGLEVEL, logmsg text); 
    PROCEDURE raise_(lg_lv KLOG.LOGLEVEL,errorCode varchar, logmsg TEXT,data_ json);
    PROCEDURE debug_file(logmsg text); 
    PROCEDURE debug_file(logmsg text,data_ json);
    PROCEDURE log_file(logmsg text); 
    PROCEDURE log_file(logmsg text,data_ json);
    PROCEDURE debug(logmsg text); 
    PROCEDURE debug(logmsg text,data_ json);
    PROCEDURE info(logmsg text); 
    PROCEDURE info(logmsg text,data_ json);
    PROCEDURE warn(logmsg text);
    PROCEDURE warn(logmsg text,data_ json);
    PROCEDURE error(logmsg text);
    PROCEDURE error(errorCode varchar,logmsg text);
    PROCEDURE error(errorCode varchar,logmsg text,data_ json);
end;

CREATE OR REPLACE PACKAGE BODY "public"."klog" AS WRAPPED
+JnCvJ7IJn/0IxIb9e0r+3a99n+n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